package com.software.cool.api.admin.v1.controller;

import cn.hutool.core.text.StrFormatter;
import com.software.cool.rabbitmq.queue.RabbitQueue;
import com.software.cool.service.impl.RabbitmqService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@Api(value = "管理端-消息队列", tags = "管理端-消息队列")
@RestController
@Slf4j
@RequestMapping("/admin/v1/mq")
@CrossOrigin
public class RabbitmqController {
    @Resource
    private RabbitmqService rabbitmqService;

    @ApiOperation(value = "发送测试", notes = "发送测试")
    @RequestMapping("/sendWork")
    public String sendWork(String message)throws Exception {
        rabbitmqService.sendWork(StrFormatter.format(RabbitQueue.AI_APP_QUEUE,"test"),message);
        return message;
    }
}
